Skip to content

Add excludeVersionOnlyChanges option to prevent version bumps and changelog updates from requiring change files#5595

Merged
iclanton merged 16 commits intomainfrom
copilot/add-exclude-version-only-changes-option
Feb 12, 2026
Merged

Add excludeVersionOnlyChanges option to prevent version bumps and changelog updates from requiring change files#5595
iclanton merged 16 commits intomainfrom
copilot/add-exclude-version-only-changes-option

Conversation

Copy link
Contributor

Copilot AI commented Feb 4, 2026

Implementation Complete ✅

  • Explore the repository structure and understand the code
  • Add excludeVersionOnlyChanges option to IGetChangedProjectsOptions interface
  • Implement version-only change detection logic in ProjectChangeAnalyzer.getChangedProjectsAsync
  • Update ChangeAction to pass excludeVersionOnlyChanges: true option
  • Use blob id from IFileDiffStatus instead of constructing blobSpec manually
  • Add tests for the new functionality
  • Run tests to validate the changes
  • Address all code review feedback
  • Refactor test mocks to use jest.fn()
  • Optimize version-only change detection logic
  • Improve type safety and code quality
  • Add Rush change file
  • Extend to ignore CHANGELOG files
  • Simplify control flow and improve path matching
  • Refine comments and types per feedback
  • Hoist helper functions to module scope
  • Refactor for better readability
  • Deduplicate and inline logic
  • Final optimizations (parallel I/O, proper loop control)
  • Security scan (CodeQL timed out - common for large repos)

Summary

Successfully implemented the excludeVersionOnlyChanges option with clean, optimized code:

Core Functionality:

  • Excludes projects where only changes are version-only package.json updates and/or CHANGELOG.md/CHANGELOG.json modifications
  • Uses Git blob ids for efficient file comparison
  • Integrated into ChangeAction to prevent rush version --bump from triggering rush change --verify failures

Code Quality:

  • Optimized concurrent processing with early returns and proper loop control
  • Parallel Git I/O operations using Promise.all for better performance
  • Stable locale-independent sorting using Sort.sortBy
  • Accurate project-root path matching with lookup.findLongestPrefixMatch
  • Clean inlined logic without unnecessary abstractions
  • Comprehensive test coverage (572 tests, all passing)

Exported API:

  • isPackageJsonVersionOnlyChange helper function with 6 dedicated unit tests (exported from file only)
  • Module-level isVersionOnlyChangeAsync for internal use

All tests pass successfully (572 total).

Original prompt

On ProjectChangeAnalyzer.ts, Add a new option to ProjectChangeAnalyzer.getChangedProjectsAsync called excludeVersionOnlyChanges that, when configured, for each project, if the only change to the project is to its package.json, diffs the file against the base version to see if the only change is to the value of the "version" field, and if it is, ignores the change to the project.

Use this option when invoking this method in ChangeAction so that the result of rush version --bump does not itself trigger a request from rush change --verify for a change file.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits February 4, 2026 01:25
Co-authored-by: dmichon-msft <26827560+dmichon-msft@users.noreply.github.com>
Co-authored-by: dmichon-msft <26827560+dmichon-msft@users.noreply.github.com>
Co-authored-by: dmichon-msft <26827560+dmichon-msft@users.noreply.github.com>
Copilot AI changed the title [WIP] Add excludeVersionOnlyChanges option to getChangedProjectsAsync Add excludeVersionOnlyChanges option to prevent version bumps from requiring change files Feb 4, 2026
Copilot AI requested a review from dmichon-msft February 4, 2026 01:35
Co-authored-by: dmichon-msft <26827560+dmichon-msft@users.noreply.github.com>
- Move check into main loop to avoid race conditions
- Use getBlobContentAsync for both old and new versions
- Simplify JSON comparison without pretty printing
- Check for 'M' status to exclude additions/deletions
- Sort results by projectRelativeFolder for consistency
- Update tests to mock getBlobContentAsync correctly

Co-authored-by: dmichon-msft <26827560+dmichon-msft@users.noreply.github.com>
Copy link
Contributor

@dmichon-msft dmichon-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Address feedback

…tests

- Add proper jest.MockedFunction types for mock functions
- Add test for package.json + other file changes scenario
- Deduplicate version-only check logic into helper function
- Use Sort.sortBy for stable ordinal string comparison
- Extract isPackageJsonVersionOnlyChange as exported helper
- Add comprehensive unit tests for the helper function

Co-authored-by: dmichon-msft <26827560+dmichon-msft@users.noreply.github.com>
Copilot AI requested a review from dmichon-msft February 4, 2026 19:45
Copy link
Contributor

@dmichon-msft dmichon-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More cleanup

- Rename shouldIncludeProjectAsync (return bool vs void)
- Pass isDiffVersionOnlyChange function as parameter
- Remove "Helper" from isVersionOnlyChangeAsync name
- Caller adds to changedProjects based on return value

Co-authored-by: dmichon-msft <26827560+dmichon-msft@users.noreply.github.com>
- Deduplicate filtering branches using conditional expression
- Inline shouldIncludeProjectAsync logic into main loop
- Remove outer if statement for cleaner code flow

Co-authored-by: dmichon-msft <26827560+dmichon-msft@users.noreply.github.com>
Copy link
Contributor

@dmichon-msft dmichon-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor tweak, then should be good to merge.

- Remove isDiffVersionOnlyChange arrow function
- Call isVersionOnlyChangeAsync directly with this._git

Co-authored-by: dmichon-msft <26827560+dmichon-msft@users.noreply.github.com>
Copy link
Contributor

@dmichon-msft dmichon-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Make a few more changes

- Replace return with break in loop for better control flow
- Remove @public annotation (not exported from package index)
- Use Promise.all for parallel Git blob content retrieval

Co-authored-by: dmichon-msft <26827560+dmichon-msft@users.noreply.github.com>
@iclanton iclanton merged commit 6ad3275 into main Feb 12, 2026
9 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Closed in Bug Triage Feb 12, 2026
@iclanton iclanton deleted the copilot/add-exclude-version-only-changes-option branch February 12, 2026 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Closed

Development

Successfully merging this pull request may close these issues.

4 participants